package com.lyp.crm.conrtoller;



import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lyp.crm.entity.Fenye;
import com.lyp.crm.entity.Student;
import com.lyp.crm.service.Studentdao;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
@Controller
@CrossOrigin(origins = "*")
public class StudentController {
	@Autowired
	private Studentdao Studentdao;
	@Autowired
	private Fenye<Student> fenye;
	
	@ApiOperation(value="多条件查询学生", notes="根据 url 的各种数据来获取学生的详细信息")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "page", value = "分页参数", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "rows", value = "分页参数", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sname", value = "姓名", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "scoid", value = "咨询师id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sqq", value = "qq号", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sphone", value = "手机号", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "shave", value = "是否有效 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "svis", value = "是否回访", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sfees", value = "是否缴费", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sreserved2", value = "查找方式", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "minqita", value = "最小日期", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "maxqita", value = "最大日期", required = true, dataType = "String", paramType = "path"), 
		
	})
	@ResponseBody
	@RequestMapping(value="/SelectStudent",method=RequestMethod.POST)
	public Fenye<Student> SelectStudent(Integer page,Integer rows,Student student,Integer zidong) {
		fenye.setT(student);
		fenye.setPage((page-1)*rows);
		fenye.setPageSize(rows);
		fenye.setZidong(zidong);
		fenye = Studentdao.selsctStudent(fenye);
		
		return fenye;
		
	}
	
	
	
	@ApiOperation(value="多条件我的查询学生", notes="根据 url 的各种数据来获取学生的详细信息")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "page", value = "分页参数", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "rows", value = "分页参数", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "uid", value = "员工id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sname", value = "姓名", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "scoid", value = "咨询师id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sqq", value = "qq号", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sphone", value = "手机号", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "shave", value = "是否有效 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "svis", value = "是否回访", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sfees", value = "是否缴费", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sreserved2", value = "查找方式", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "minqita", value = "最小日期", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "maxqita", value = "最大日期", required = true, dataType = "String", paramType = "path"), 
		
	})
	@ResponseBody
	@RequestMapping(value="/SelectStudent1",method=RequestMethod.POST)
	public Fenye<Student> SelectStudent1(Integer page,Integer rows,Student student) {
		fenye.setT(student);
		fenye.setPage((page-1)*rows);
		fenye.setPageSize(rows);
		fenye = Studentdao.selsctStudent1(fenye);
		return fenye;
	}
	
	@ApiIgnore
	@ResponseBody
	@RequestMapping(value="/SelectStudent2",method=RequestMethod.POST)
	public Fenye<Student> SelectStudent2(Integer page,Integer rows,Student student) {
		fenye.setT(student);
		fenye.setPage((page-1)*rows);
		fenye.setPageSize(rows);
		fenye = Studentdao.selsctStudent2(fenye);
		return fenye;
	}
	@ApiOperation(value="增加学生信息", notes="根据 url 的各种数据来获取增加学生的详细信息")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "sname", value = "姓名", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "ssex", value = "性别", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sage", value = "年龄", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sxueli", value = "学历", required = true, dataType = "String", paramType = "path"),
		@ApiImplicitParam(name = "sqq", value = "qq号", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "swechat", value = "微信", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sphone", value = "手机号", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sstate", value = "状态", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sgrade", value = "打分", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "scourse", value = "课程方向", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "schannel", value = "来源渠道", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "santistop", value = "来源关键词", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "swebsite", value = "来源网站", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "scoid", value = "咨询师id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "swciid", value = "网络咨询师id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "scoremark", value = "咨询师备注 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "senid", value = "录入人id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "shave", value = "是否有效 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "svis", value = "是否回访", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sesdate", value = "创建时间 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "svisitdate", value = "上门时间 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sfirstdate", value = "首次回访时间 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sfees", value = "是否缴费", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "smoney", value = "缴费金额", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "shave", value = "是否有效", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "scause", value = "无效原因", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sreport", value = "是否报备", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sremark", value = "在线备注", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "spay", value = "缴费时间", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sclass", value = "是否进班", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "scldate", value = "进班时间", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sclmark", value = "进班备注", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sattention", value = "学生关注", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "spremium", value = "是否退费", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "spre", value = "退费原因", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "seamoney", value = "定金金额", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "seadate", value = "定金时间", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sreserved2", value = "查找方式", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "minqita", value = "最小日期", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "maxqita", value = "最大日期", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "stianjia", value = "添加动态", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sdtuname", value = "动态添加人名字", required = true, dataType = "String", paramType = "path"), 
		
	})
	@RequestMapping(value="/insertStudent",method=RequestMethod.POST)
	@ResponseBody
	public Integer insertStudent(Student student) {
	
		return Studentdao.insertStudent(student);
	}
	@ApiOperation(value="修改学生信息", notes="根据 url 的各种数据来修改学生信息的详细信息")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "sid", value = "id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sname", value = "姓名", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "ssex", value = "性别", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sage", value = "年龄", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sxueli", value = "学历", required = true, dataType = "String", paramType = "path"),
		@ApiImplicitParam(name = "sqq", value = "qq号", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "swechat", value = "微信", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sphone", value = "手机号", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sstate", value = "状态", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sgrade", value = "打分", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "scourse", value = "课程方向", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "schannel", value = "来源渠道", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "santistop", value = "来源关键词", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "swebsite", value = "来源网站", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "scoid", value = "咨询师id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "swciid", value = "网络咨询师id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "scoremark", value = "咨询师备注 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "senid", value = "录入人id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "shave", value = "是否有效 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "svis", value = "是否回访", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sesdate", value = "创建时间 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "svisitdate", value = "上门时间 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sfirstdate", value = "首次回访时间 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sfees", value = "是否缴费", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "smoney", value = "缴费金额", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "shave", value = "是否有效", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "scause", value = "无效原因", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sreport", value = "是否报备", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "sremark", value = "在线备注", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "spay", value = "缴费时间", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sclass", value = "是否进班", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "scldate", value = "进班时间", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sclmark", value = "进班备注", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sattention", value = "学生关注", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "spremium", value = "是否退费", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "spre", value = "退费原因", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "seamoney", value = "定金金额", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "seadate", value = "定金时间", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sreserved2", value = "查找方式", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "minqita", value = "最小日期", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "maxqita", value = "最大日期", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "stianjia", value = "添加动态", required = true, dataType = "String", paramType = "path"), 
		@ApiImplicitParam(name = "sdtuname", value = "动态添加人名字", required = true, dataType = "String", paramType = "path"), 
		
	})
	@RequestMapping(value="/updateStudent",method=RequestMethod.POST)
	@ResponseBody
	public Integer updateStudent(Student student) {
	Integer i = Studentdao.updateStudent(student);
		return i;
	}
	@ApiOperation(value="将学生添加信息为空", notes="根据 url 的sid将学生添加信息字段为空")
	@ApiImplicitParam(name = "sid", value = "id", required = true, dataType = "Integer", paramType = "path") 
	
	@RequestMapping(value="/updatedeletesid",method=RequestMethod.POST)
	@ResponseBody
	public Integer updatedeletesid(Integer sid) {
		return Studentdao.updatedeletesid(sid);
	}
	@ApiOperation(value="删除学生信息", notes="根据 url 的sid删除学生信息")
	@ApiImplicitParam(name = "sid", value = "id", required = true, dataType = "Integer", paramType = "path") 
	
	@RequestMapping(value="/delectStudent",method=RequestMethod.POST)
	@ResponseBody
	public Integer delectStudent(Integer sid) {
	
		return Studentdao.delectStudent(sid);
	}
	
	@ApiOperation(value="查询我的学生信息", notes="根据 url 的uid查找我的学生信息")
	@ApiImplicitParam(name = "uid", value = "员工id", required = true, dataType = "Integer", paramType = "path") 
	
	@ResponseBody
	@RequestMapping(value="/selectUserStudent",method=RequestMethod.POST)
	public List<Student> selectUserStudent(Integer uid) {
		return Studentdao.selectUserStudent(uid);
	}

	@ApiOperation(value="查询我的学生信息总条数", notes="根据 url 的uid查找我的学生信息总条数")
	@ApiImplicitParam(name = "uid", value = "员工id", required = true, dataType = "Integer", paramType = "path") 
	
	@ResponseBody
	@RequestMapping(value="/selectUserStudentcount",method=RequestMethod.POST)
	public Integer selectUserStudentcount(Integer uid) {
		return Studentdao.selectUserStudentcount(uid);
	}
	@ApiOperation(value="开启自动分配", notes="开启自动分配学生")
	@ResponseBody
	@RequestMapping(value="/studentzidongfenpei",method=RequestMethod.POST)
	public Integer studentzidongfenpei() {
		return Studentdao.studentzidongfenpei();
	}
	@ApiOperation(value="修改学生是否无效字段", notes="根据 url 的数据来修改学生是否无效字段和无效原因")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "sid", value = "id", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "shave", value = "是否有效 ", required = true, dataType = "Integer", paramType = "path"), 
		@ApiImplicitParam(name = "scause", value = "无效原因", required = true, dataType = "String", paramType = "path"), 
		
	})
	@ResponseBody
	@RequestMapping(value="/updatescause",method=RequestMethod.POST)
	public Integer updatescause(Student student) {
		return Studentdao.updatescause(student);
	}
	
}
